package com.descartes.mymedia.controller.consultation;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import com.descartes.mymedia.model.Profil;

@Controller
public class MediaList {

	@RequestMapping(value="/viewMedias", method=RequestMethod.GET)
	public ModelAndView get(HttpServletRequest request){
		Profil p = (Profil) request.getSession().getAttribute("profil");
		ModelAndView modelAndView = new ModelAndView();
		modelAndView.addObject("listeMedias", p.getMedias());
		modelAndView.setViewName("viewMedias");
		return modelAndView;
	}

}
